package com.cn.ctrl

import com.cn.model.Company
import com.fasterxml.jackson.databind.ObjectMapper
import org.springframework.lang.Nullable
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("company")
class CompanyController {

    @PostMapping("b")
    fun company(@Nullable @RequestBody com: Company?): String {
        val company = com ?: Company()
        company.id = "1"
        company.name = "name"

        return ObjectMapper().writeValueAsString(company)
    }
}